package me.gacl.shiro.example.web.listener;

import org.apache.shiro.session.Session;
import org.apache.shiro.session.SessionListener;

/**
 * shiro 会话监听器
 * 会话监听器用于监听会话创建、过期及停止事件
 */
public class MySessionListener1 implements SessionListener {

    @Override
    public void onStart(Session session) {//会话创建时触发
        System.out.println("MySessionListener1→会话创建，sessionId=" + session.getId());
    }
    @Override
    public void onExpiration(Session session) {//会话过期时触发
        System.out.println("MySessionListener1→会话过期，sessionId=" + session.getId());
    }
    @Override
    public void onStop(Session session) {//退出/会话过期时触发
        System.out.println("MySessionListener1→会话停止，sessionId=" + session.getId());
    }

}
